﻿using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using RabbitMQ.Client;
using ZL.CRM.CommonEntity.AccOpr.Web;
using ZL.Web.Utility.Log;
using ZL.Web.Utility.MQ;
using ZLWeb.WebApiEntity.WechatCardModel;

namespace ZLWeb.WebApiControllers.Log
{
    public class ZLEventLog: ILog<ZL.CRM.CommonEntity.AccOpr.Web.AccWxCardAddDetail>, ILog<ZL.CRM.CommonEntity.AccOpr.Web.AccThrOpenYwdetail>, ILog<Wxlog>, ILog<ZL.CRM.CommonEntity.AccOpr.Web.AccThrCzYwdetail>, ILog<ZL.CRM.CommonEntity.AccOpr.Web.AccBindingCardYwdetail>
    {
        private static ConcurrentQueue<ZL.CRM.CommonEntity.AccOpr.Web.AccThrOpenYwdetail> _AccThrOpenlogs;
        private static ConcurrentQueue<ZL.CRM.CommonEntity.AccOpr.Web.AccWxCardAddDetail> _AccWxCardlogs;
        private static ConcurrentQueue<Wxlog> _Wxlog;
        private static ConcurrentQueue<ZL.CRM.CommonEntity.AccOpr.Web.AccThrCzYwdetail> _AccThrCzYw;
        private static ConcurrentQueue<ZL.CRM.CommonEntity.AccOpr.Web.AccBindingCardYwdetail> _BindingCard;

        static ZLEventLog()
        {
            _AccThrOpenlogs=new ConcurrentQueue<ZL.CRM.CommonEntity.AccOpr.Web.AccThrOpenYwdetail>();
            _AccWxCardlogs = new ConcurrentQueue<ZL.CRM.CommonEntity.AccOpr.Web.AccWxCardAddDetail>();
            _Wxlog=new ConcurrentQueue<Wxlog>();
            _AccThrCzYw=new ConcurrentQueue<ZL.CRM.CommonEntity.AccOpr.Web.AccThrCzYwdetail>();
            _BindingCard = new ConcurrentQueue<ZL.CRM.CommonEntity.AccOpr.Web.AccBindingCardYwdetail>();
        }

        public ZLEventLog()
        {
            this.Accid = Accid;
        }

        public ZLEventLog(long Accid, string Openid)
        {
            this.Accid = Accid;
            this.Openid = Openid;
        }

        public long Accid { get; set; }

        public string Openid { get; set; }

        public static ZLEventLog CreateZLEventLog(long Accid, string Openid)
        {
            return new ZLEventLog(Accid,Openid);
        }


        /// <summary>
        /// 卡关联详情
        /// </summary>
        /// <param name="log"></param>
        public void LogAction(ZL.CRM.CommonEntity.AccOpr.Web.AccWxCardAddDetail log)
        {
            log.accid = Accid;
            log.Openid = Openid;
            MQHelper.Send(log);
        }

        /// <summary>
        /// 开户详情
        /// </summary>
        /// <param name="log"></param>
        public void LogAction(ZL.CRM.CommonEntity.AccOpr.Web.AccThrOpenYwdetail log)
        {
            log.accid = Accid;
            log.Openid = Openid;
            MQHelper.Send(log);
        }

        /// <summary>
        /// 充值详情
        /// </summary>
        /// <param name="log"></param>
        public void LogAction(Wxlog log)
        {
            //log.accid = Accid;
            //log.Openid = Openid;
            //MQHelper.Send(log);
        }

        /// <summary>
        /// 充值详情
        /// </summary>
        /// <param name="log"></param>
        public void LogAction(ZL.CRM.CommonEntity.AccOpr.Web.AccThrCzYwdetail log)
        {
            log.accid = Accid;
            log.Openid = Openid;
            MQHelper.Send(log);
        }

        /// <summary>
        /// 绑定实体卡详情
        /// </summary>
        /// <param name="log"></param>
        public void LogAction(ZL.CRM.CommonEntity.AccOpr.Web.AccBindingCardYwdetail log)
        {
            log.accid = Accid;
            log.Openid = Openid;
            MQHelper.Send(log);
        }


    }
}
